CreateRecord(TableName)

Creates a new record object in a specified database table. To save the record object, you must call the SaveChanges() method. The SaveChanges() method is automatically called by the Execute(Arg) method of most blocks when the mode is set to Save.

Parameters

TableName. Specifies the name of the table where the record is to be created. This can be the Sage CRM system database or an external database to which Sage CRM is connected.

Examples

<!-- #include file = "sagecrm.js"-->
<%
var Comp;
var block;
Comp = CRM.CreateRecord('company');
Comp.item('comp_Name') = 'My company';
Comp.SaveChanges();
block = CRM.GetBlock("companygrid");
CRM.AddContent(block.Execute(''));
Response.Write(CRM.GetPage());
%>

Creates a new company record.